<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>配送关系管理</title>
 <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1>配送关系管理</h1>
        <ol class="breadcrumb">
           <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#">采购目录管理</a></li>
            <li class="active"><a href="#">我的产品</a></li>
            <li class="active"><a href="#">配送关系查看</a></li>
        </ol>
    </section>
        <div class=" box box-success">
            <div class="box-body">
                <div class="form-inline">  
                <div class="form-group form-group-xs">
                        <label>商品编码：</label>
                        <input class="form-control" type="text" id="goodsCode" name="goodsCode" placeholder="商品编码"  />
                    </div>              
                    <div class="form-group form-group-xs">
                        <label>药品编码：</label>
                        <input class="form-control" type="text" id="drugCode" name="drugCode" placeholder="药品编码"  />
                    </div>
                    <div class="form-group form-group-xs">
                        <label>通用名：</label>
                        <input class="form-control" type="text" id="drugName" name="drugName" placeholder="通用名"  />
                    </div>
                    <div class="form-group form-group-xs">
                        <label>药品来源：</label>
                        <select id="drugSource" name="drugSource" class="form-control"></select>
                    </div>
                    <button type="button" onclick="gridSerch();" class="btn btn-success btn-xs">查&nbsp;询</button>
                </div>                
            </div>
        </div>
<div style="margin-top: 5px;"></div>
    <table class="jqgrid" id="list4"></table>
<div style="margin-top: 10px;"></div>

<div id="prowed2"></div>
<%@ include file="/WEB-INF/component/commonJS.jsp"%>
<script type="text/javascript">
$(document).ready(function (){
    jQuery("#list4").jqGrid({
        url: "${ctx}/baseGoods/getProDelDrugDataList.html",
        mtype: "GET",
        datatype: "json",
        autowidth: true,
        shrinkToFit: false,
        height: 250,
        colNames:['商品编码','药品编码','通用名','剂型','规格','转换系数','单位','药品来源','所属项目','操作'],
        colModel:[
            {name:'goodsCode',index:'goodsCode',key:true,width:100,align:"center", sorttype:false},//商品编码
            {name:'drugCode',index:'drugCode',width:100,align:"center", sorttype:false},
            {name:'drugName',index:'drugName',width:150},
            {name:'formName',index:'formName',width:80, align:"left",sorttype:false},
            {name:'specName',index:'specName',width:80, align:"left",sorttype:false},
            {name:'factor',index:'factor',width:60,align:"center", sorttype:false},
            {name:'unit',index:'unit',width:60,align:"center", sorttype:false},
            {name:'drugSource',index:'drugSource',width:100, sorttype:false},
            {name:'projectName',index:'projectName',width:100, sorttype:false},
            {name:'oper',index:'n19',width:300, align:"center",
                formatter : function(val, opts, rowdata) {
                    return "<a href='${ctx}/baseGoods/toBaseGoodsDelByArea.html?goodsCode="+rowdata.goodsCode+"'>按区域设置配送企业</a><a href='${ctx}/baseGoods/toBaseGoodsDelByComp.html?goodsCode="+rowdata.goodsCode+"'>按企业设置配送区域</a>"
                            +"<a href='${ctx}/baseGoods/toBaseDelByGoods.html?goodsCode="+rowdata.goodsCode+"'>查看配送关系</a>"
                }   
            },
        ],
        gridComplete: function(){
            var ids = jQuery("#list4").jqGrid('getDataIDs');
            for(var i=0;i < ids.length;i++){
                var cl = ids[i];
                if (i % 2 == 0) {
                    ae = "&nbsp;&nbsp;<a href='javascript:hosDel("+cl+");' >禁用</a>&nbsp;&nbsp;";
                } else {
                    ae = "&nbsp;&nbsp;<a href='javascript:hosDel("+cl+");' >启用</a>&nbsp;&nbsp;";
                }
                jQuery("#list4").jqGrid('setRowData',ids[i],{act:ae});
            }   
        },
         rowNum: 10,
         rowList: [10, 20, 30],
         rownumbers: true,
         pager: "#prowed2",
         viewrecords: true,
         caption: "配送关系管理列表",
         editurl:"proPlanItemListHis.jsp",
         jsonReader: {
             repeatitems: false,
             id: "ids"
         }
        
    });
    $("#drugSource").HNSelect({
        url: "${pageContext.request.contextPath}/selectController/getDicSys.html", data: { ID: '112' },defaultselect:'${form.patternType}',  defaultText: "<option value=''>请选择</option>",
    });
})

function gridSerch(){
    var goodsCode = $.trim($("#goodsCode").val());
    var drugCode = $.trim($("#drugCode").val());
    var drugName = $.trim($("#drugName").val());
    var drugSource = $.trim($("#drugSource").val());
    $("#list4").jqGrid('setGridParam',{  
        datatype:'json',
        postData:{"goodsCode":goodsCode,
                "drugCode":drugCode,
                "drugName":drugName,
                "drugSource":drugSource}
    }).trigger("reloadGrid"); //重新载入  
}











     function edit(cl){
         window.location.href="delRelDrugQuery.jsp";
     }
    function save(cl){
         alert("保存信息");
    }
    jQuery("#list4").jqGrid('navGrid',"prowed2",{edit:false,add:false,del:false});
    function hosAdd(){
        window.location.href="hospEdit.jsp";
    }

    function hospAuditDetail(){
        alert("显示信息详情");
        //window.location.href = "hospAuditDetail.jsp";
    }
    function refash(){
        location.reload();
    }
    function gridReload(){
        var area=document.getElementById("area").value;
        alert("查询地区名："+area);
    }
    function goJsp(n1){
        var opt ={
                url:"../../jsp/price/priceChangeExeDetailGrid.jsp",
                title:"newwindow",
style:{height:400,width:890,top:200,left:270}
        };
        $.HN.dialog.open(opt);
    }
     function lookYPnumber(ypnumber){
            var opt={
                    url:"../../jsp/price/priceChangeDetailYP.jsp",
                    title:"newwindow",
    style:{height:400,width:890,top:200,left:270}
            };
            $.HN.dialog.open(opt);
        }
        
</script>
</body>
</html>